<?php

$router->group(['prefix' => 'shop'], function () use ($router) {
    $router->post('login', 'AuthController@issueToken');
    $router->post('image/upload', 'UploadController@upload');

    $router->get('balance/schemes', 'BalanceController@getSchemes');
    $router->get('user/coupon', 'CouponController@getCoupon');
    $router->get('user/detail/{user_id}', 'UserController@detail');
    $router->get('order/detail/{order_no}', 'OrderController@detail');
    $router->get('point/proportion', 'SettleController@getPointProportion');

    $router->get('print', 'PrintController@index')->name('api.print.index');
    $router->get('print/refund', 'PrintController@refund')->name('api.print.refund');

    $router->group(['middleware' => ['auth:clerk', 'O2O']], function () use ($router) {
        $router->get('getStockByID/{id}', 'GoodsController@getStockByID');
        $router->get('getProductsByCredentials', 'GoodsController@getProductsByCredentials');
        $router->get('getProductByScanSku', 'GoodsController@getProductByScanSku');


        $router->get('getUsersByCredentials', 'UserController@getUsersByCredentials');
        $router->post('user/add', 'UserController@store');
        $router->get('getSystemUser', 'UserController@getSystemUser');

        /*$router->post('order/checkout', 'ShoppingController@checkout');
        $router->post('order/confirm', 'ShoppingController@confirm');*/

        $router->post('order/checkout', 'SettleController@checkout');
        $router->post('order/confirm', 'SettleController@confirm');


        $router->get('order/list', 'OrderController@index');
        $router->get('clerk/list', 'ClerkController@list');

        $router->post('balance/order/checkout', 'BalanceController@checkout');
        $router->post('balance/order/paid', 'BalanceController@paid');
        $router->get('balance/order/list', 'BalanceController@list');
        $router->get('balance/order/detail/{order_no}', 'BalanceController@detail');

        $router->get('goods/stock/query', 'StockQueryController@getGoodsSkuStoredList');

        $router->get('getQueryFields', 'StockQueryController@getQueryFields');

        //现金收支
        $router->post('cash/record/store', 'CashRecordController@store');
        $router->get('cash/record/list', 'CashRecordController@list');

        //交接班
        $router->get('statistics', 'StatisticsController@index');

        $router->get('discount', 'DiscountController@getDiscountByShopID');

        //售后
        $router->post('refund/checkout', 'RefundController@checkout');
        $router->post('refund/apply', 'RefundController@apply');
        $router->post('refund/confirm', 'RefundController@confirm');
        $router->get('refund/refundSuccess', 'RefundController@refundSuccess');

        //采购入库
        $router->get('warehouse/getProductData', 'PurchaseController@getProductData');
        $router->post('warehouse/purchase', 'PurchaseController@purchase');
        $router->get('warehouse/getPurchaseData', 'PurchaseController@getPurchaseData');
        $router->get('warehouse/getPurchaseItem', 'PurchaseController@getPurchaseItem');

        //库存盘点
        $router->get('warehouse/getTakePlans', 'StockTakeController@getTakePlans');
        $router->get('warehouse/getTakeProductData', 'StockTakeController@getTakeProductData');
        $router->get('warehouse/getTakeProductDataByCode', 'StockTakeController@getTakeProductDataByCode');
        $router->post('warehouse/saveTakeStock', 'StockTakeController@saveTakeStock');

        $router->get('warehouse/getTakeList', 'StockTakeController@getTakeList');
        $router->get('warehouse/getTakeItems', 'StockTakeController@getTakeItems');


        //库存调拨
        $router->post('warehouse/TransferController', 'TransferController@saveTransfer');
        $router->get('warehouse/getTransferList', 'TransferController@getTransferList');
        $router->get('warehouse/getTransferItem', 'TransferController@getTransferItem');

        $router->get('warehouse/transferConfirm', 'TransferController@confirm');
    });
});